{include file='public/header' /}
<div class="layuimini-container">
    <form id="modelUserForm" lay-filter="modelUserForm" class="layui-form model-form">
        <input name="id" type="hidden" value="{$row->id}"/>
        <div class="layui-card-header layuiadmin-card-header-auto">
            <h2>更新问题</h2>
        </div>

        <div class="layui-form-item">
            <label for="" class="layui-form-label">问题：</label>

            <div class="layui-input-inline">
                <textarea name="answer" style="width:300px;" placeholder="请输入问题" class="layui-textarea" lay-vertype="tips" lay-verify="required" required="">{$row->answer}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="" class="layui-form-label">解答：</label>
            <div class="layui-input-inline">
                <textarea name="question" placeholder="请输入解答" style="width:300px;"  class="layui-textarea" lay-vertype="tips" lay-verify="required" required="">{$row->question}</textarea>
            </div>
        </div>


        <div class="layui-form-item text-center">
            <button class="layui-btn layui-btn-primary" type="button" onclick="close_window()" ew-event="closePageDialog">取消</button>
            <button class="layui-btn" lay-filter="modelSubmitUser" lay-submit>保存</button>
        </div>
    </form>
</div>
{include file='public/footer' /}
<script>
    layui.use(['layer', 'form', 'table', 'util', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;


        var url = '{:__url("system.question/edit")}';


        // 表单提交事件
        form.on('submit(modelSubmitUser)', function (data) {
            layer.load(2);
            console.log(data);
            $.post(url, data.field, function (res) {

                layer.closeAll('loading');
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1,time: 1000},function(index){
                        window.parent.location.reload();
                    });
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'json');
            return false;
        });
    });
    function close_window(){
        window.parent.location.reload();
    }
</script>
<script>
    layui.use(['upload','layer','element','form'],function () {
        var $ = layui.jquery;
        var upload = layui.upload;
    })

</script>
<link href="/baidu-editor/themes/default/css/umeditor.min.css" type="text/css" rel="stylesheet">
<script src="/baidu-editor/third-party/jquery.min.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/baidu-editor/umeditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/baidu-editor/umeditor.min.js"></script>
<!-- 实例化编辑器 -->
